<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>Server Status</h1>
    <div id="status">
        <p>Loading...</p>
    </div>

    <script>
    const eventSource = new EventSource('http://localhost:5000/auth/media/Progress?filename=demo.txt');

    eventSource.onmessage = function (event) {
        const status = JSON.parse(event.data);
        console.log(status)
        if (status.percent === 100) {
            eventSource.close();
        }
    };

    eventSource.onerror = function (error) {
        console.error("Error occurred: ", error);
    };
</script>
</body>
</html>